package com.school.service;

import com.school.dao.LetterDAO;
import com.school.entity.Letter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LetterService {
    @Autowired
    private LetterDAO dao;

    @Override
    public String toString() {
        return "AboutService{" +
                "dao=" + dao +
                '}';
    }

    public int insertOne(Letter letter) {
        int i = 0;
        try {
            i = dao.insertOne(letter);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return i;
    }

    public Letter[] selectAll() {
        Letter[] letters = dao.selectAll();
        return letters;
    }

    public Letter selectOne(String name) {
        Letter letter = dao.selectOne(name);
        return letter;
    }


}
